package com.lx.test;

public class parseintdemo {
    public static void main(String[] args) {
        String str = "1234560";
        if(!str.matches("[1-9]\\d{0,9}"))
        {
            System.out.println("格式错误");
        }
        else
        {
            System.out.println("格式正确");
        }
        int sum = 0;
        for (int i = 0; i < str.length(); i++) {
            int num = str.charAt(i)-'0';
            sum = sum*10+num;
        }
        System.out.println(sum);
    }
}
